package com.example.bbs.kafka.consumer;

import com.alibaba.fastjson.JSON;
import com.example.bbs.domain.entity.Comment;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

import java.util.Objects;


/**
 * 消费通知信息
 */
@Component
public class NoticeConsumer {

    @KafkaListener(topics = "notice-comment")
    public void handleCommentNotice(ConsumerRecord consumerRecord) {
        if (Objects.isNull(consumerRecord) || Objects.isNull(consumerRecord.value())) {
            return;
        }
        //解析数据
        Comment comment = JSON.parseObject((String) consumerRecord.value(), Comment.class);

        //处理数据



    }



}
